#ifndef SCANNER_H_INCLUDED
#define SCANNER_H_INCLUDED

#include <stdio.h>
#include <stdlib.h>
#include "GCCMakros.h"
#include <time.h>
#include <string.h>

#define TIMES   1
#define DIV     2
#define MOD     3
#define AND     4
#define PLUS    5
#define MINUS   6
#define OR      7
#define EQL     8
#define NEQ     9
#define LSS     10
#define LEQ     11
#define GRT     12
#define GEQ     13
#define PERIOD  14
#define ARROW   15
#define COMMA   16
#define COLON   17
#define RBRACE  18
#define RBRAK   19
#define RPAREN  20
#define LBRACE  21
#define LBRAK   22
#define LPAREN  23
#define NOT     24
#define BECOME  25
#define BOOL    26
#define NUMBER  27
#define CONST   28
#define CHAR    29
#define IDENT   30
#define TYPE    31
#define PTR     32
#define STRING  33
#define ELSE    34
#define ELIF    35
#define IF      36
#define WHILE   37
#define STRUCT  38
#define TYP     39
#define TYPEDEF 40
#define FUNC    41
#define NEW     42
#define RETURN  43
#define INVOL   44
#define SEQ     45
#define ENDF    46
#define UNKN    47

#define KEYTABLENGTH    23
#define VALLENGTH       100

typedef char ptr string_t;

struct key
{
    int sym;
    int length;
    string_t value;
    int line;
    int column;
};

typedef struct key ptr key_type;
typedef key_type ptr keyTab_t;

int         colCounter;
int         lnCounter;
int         read;
char        current;
char ptr    value;
FILE ptr    file;
FILE ptr    logfile;
char test[VALLENGTH];

int         errCount;
string_t    currentValue;
keyTab_t    keyTab;
key_type       curKey;

void initScanner(char ptr filename);
void clearScanner();
void get();
void printSymInfo();
void nextChar();
void keyword();
void forgetSpaces();
void skipComment();
void checkPos();
void string();
void initKeyTab();
void mark(char ptr msg, int err);
void clearOld();
string_t getCurValue();

#endif // SCANNER_H_INCLUDED
